package Day15.poly_.five;

//instanceOf 比较操作符，用于判断对象的运行类型是否为XX类型或者XX类型的子类型
public class PolyDetail03 {
    public static void main(String[] args) {
        BB bb = new BB();
        System.out.println(bb instanceof BB);//true
        System.out.println(bb instanceof AA);//TRUE

        //aa的编译类型是AA 运行类型是BB
        //BB 是AA 的子类
        AA aa = new BB();
        System.out.println(aa instanceof AA);//true
        System.out.println(aa instanceof BB);//true

        Object obj=new Object();
        System.out.println(obj instanceof AA);//FALSE
        String str="hello";
        //System.out.println(str instanceof AA);
        System.out.println(str instanceof Object);//true
    }
}

class AA {
    //父类
}

class BB extends AA {
    //子类
}